<template>
    <rx-layout>
        <div slot="center" style>
            <rx-fit>
                <div slot="toolheader" foldheader="true" foldbtn="false" border="false">

          <span class="search-btn-box">
                <span class="search-btn" @click="searchshow"><i class="iconfont iconguolv"></i>{{$ti18('rxList.leachBtn','过滤')}}</span>
           </span>
                </div>
                <div slot="searchbar" btnalign="right" v-if="fitSearch" @search="search" @cancel="cancel"
                     @close="close">
                    <a-form layout="vertical">
                        <a-form-item :label="i18n('form.employeeNum','离职人员账号')">
                            <a-input :placeholder="i18n('form.employeeNum','离职人员账号','input')"
                                     v-model="queryParam.Q_QUIT_USER_NO__S_LK"/>
                        </a-form-item>
                        <a-form-item :label="i18n('form.employee','离职人员')">
                            <a-input :placeholder="i18n('form.employee','离职人员','input')"
                                     v-model="queryParam.Q_QUIT_USER_NAME__S_LK"/>
                        </a-form-item>
                        <a-form-item :label="i18n('form.processHead','流程定义标题')">
                            <a-input :placeholder="i18n('form.processHead','流程定义标题','input')"
                                     v-model="queryParam.Q_DEF_NAME__S_LK"/>
                        </a-form-item>
                        <a-form-item :label="i18n('form.processID','流程节点ID')">
                            <a-input :placeholder="i18n('form.processID','流程节点ID','input')"
                                     v-model="queryParam.Q_NODE_ID__S_LK"/>
                        </a-form-item>
                        <a-form-item :label="i18n('form.processName','流程节点名称')">
                            <a-input :placeholder="i18n('form.processName','流程节点名称','input')"
                                     v-model="queryParam.Q_NODE_NAME__S_LK"/>
                        </a-form-item>
                    </a-form>
                </div>
                <rx-grid
                    ref="table"
                    :allowRowSelect="true"
                    :multiSelect="true"
                    :columns="columns"
                    :defaultPageSize="10"
                    url="/api-bpm/bpm/core/bpmQuitUserTask/query"
                    :queryParam="queryParam"
                    data-field="result.data"
                    :pageSizeOptions="['10','30','40']"
                    id-field="id"
                    @selectChange="onSelectChange"
                >
           <span slot="action" slot-scope="{text, record}" class="actionIcons">
               <span v-show="findAuthRight('def.design')"
                     @click.stop="handleDesign(record.defId)">{{ i18n('list.proDesign', '流程设计') }}</span>
              <span v-if="editEnable" @click="deliver(record)">{{ i18n('list.handover', '交接') }}</span>
              <span v-if="removeEnable" @click="delByIds([record.id])">{{ $ti18('rxList.delBtn', '删除') }}</span>
            </span>
                </rx-grid>
            </rx-fit>
        </div>
    </rx-layout>
</template>

<script>
import BpmQuitUserTaskApi from '@/api/bpm/core/bpmQuitUserTask';
import BpmDefApi from '@/api/bpm/core/bpmDef';
import BpmQuitUserDeliver from './BpmQuitUserDeliver';
import {BaseList, RxFit, Util} from '@lowcode/jpaas-common-lib';

export default {
    name: 'BpmQuitUserTaskList',
    mixins: [BaseList],
    components: {
        RxFit
    },
    data() {
        return {
            columns: [
                {
                    title: this.$ti18('rxList.index', '序号'),
                    type: 'indexColumn',
                    width: 60,
                    dataIndex: 'serial',
                    scopedSlots: {customRender: 'serial'}
                },
                {title: this.i18n('form.employeeNum', '离职人员账号'), dataIndex: 'quitUserNo', width: 120},
                {title: this.i18n('form.employee', '离职人员'), dataIndex: 'quitUserName', width: 100},
                {title: this.i18n('form.processHead', '流程定义标题'), dataIndex: 'defName', width: 120},
                {title: this.i18n('form.processName', '流程节点名称'), dataIndex: 'nodeName', width: 100},
                {title: this.$ti18('rxForm.createTime', '创建时间'), dataIndex: 'createTime', width: 200},
                {
                    title: this.$ti18('rxList.action', '操作'),
                    width: 100,
                    dataIndex: 'action',
                    scopedSlots: {customRender: 'action'}
                }
            ],
            comment: this.i18n('list.workHand', '工作交接'),
            widthHeight: ['800px', '600px'],
            fitSearch: false,
        }
    },
    methods: {
        i18n(name, text, key) {
            return this.$ti18(name, text, "bpmDeliver", key);
        },
        delById(ids) {
            return BpmQuitUserTaskApi.del({ids: ids.join(',')});
        },
        getListByParams(parameter) {
            return BpmQuitUserTaskApi.query(parameter)
        },
        handleDesign(defId) {
            let url = BpmDefApi.designBaseUrl;
            if (defId) {
                url = url + '?defId=' + defId;
            }
            window.open(url);
        },
        deliver(record) {
            Util.open({
                component: BpmQuitUserDeliver,
                curVm: this,
                widthHeight: ['600px', '400px'],
                data: {
                    deliverUserId: record.quitUserId,
                    deliverUserNo: record.quitUserNo,
                    deliverUserName: record.quitUserName
                },
                title: this.i18n('list.handover', '交接')
            }, function (action, data) {

            });

        }

    }
}
</script>
<style scoped>

</style>

